<template>
	<div class="pb30">
		<div class=" mt20">
			<div class="plr30 border-bottom pb20 relative">
				<span class="fb mr20">归属记录</span>
			</div>
			<div class="plr30 mt20">
				<el-table :data="tableData" style="width: 100%"
					:cell-style="{ textAlign: 'center','line-height':'54px'}"
					:header-cell-style="{ 'text-align': 'center','line-height':'54px','height':'54px!important'  }">
					<el-table-column prop="userName" label="目前归属"/>
					<el-table-column prop="frontUserName" label="原来归属">
						<template #default="scope">
							{{scope.row.frontUserName || '-'}}
						</template>
					</el-table-column>	
					<el-table-column prop="customerTypeName" label="客户类型" />
					<el-table-column prop="customerStatusName" label="客户状态" />
					<el-table-column prop="startTime" label="保护起始" />
					<el-table-column prop="endtTime" label="保护截止" />
					<el-table-column prop="createUserName" label="操作人" />
					<el-table-column prop="createTime" label="归属时间" />
				</el-table>
			</div>
		</div>
		<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize"
		 @pagination="belongToRecord"
		 />
	</div>
</template>

<script>
	import { belongToRecord } from '@/api/business/customer' 
	export default{
		props:{
			activeName:{
				type:String,
				default:''
			},
			customerTypeProps:{
				type:Object,
				default:{}
			},
			bus_customer_type:{
				type:Array,
				default:res=>{return []}
			},
			bus_customer_status:{
				type:Array,
				default:res=>{return []}
			},
		},
		data(){
			return{
				total:10,
				queryParams:{
					pageNum:1,
					pageSize:10,
				},
				loading:true,
				tableData: [],
			}
		},
		watch:{
			activeName(){
				let that = this
				if(this.activeName == 'message8'){
					this.belongToRecord()
				}
			}
		},
		methods:{
			belongToRecord(){
				belongToRecord(this.customerTypeProps.userId,this.queryParams).then(res=>{
					this.tableData = res.rows
					this.total = res.total
					for(let i in this.tableData){
						for(let key in this.bus_customer_type){
							if(this.tableData[i].customerType == this.bus_customer_type[key].value){
								this.tableData[i].customerTypeName = this.bus_customer_type[key].label
							}
						}
						for(let j in this.bus_customer_status){
							if(this.tableData[i].customerStatus == this.bus_customer_status[j].value){
								this.tableData[i].customerStatusName = this.bus_customer_status[j].label
							}
						}
					}
					
				})
			},
		}
	}
</script>

<style>
</style>